function Login(handle,ids){
    var that=this;
    this.handle=document.getElementById(handle);
    this.mask=getClassName("mask")[0];
    this.box=document.getElementById(ids);
    this.close=getClassName("close",ids)[0];
    this.target=(this.mask.offsetWidth-this.box.offsetWidth)/2
    this.body=document.getElementsByTagName("body")[0];
    
}
Login.prototype.maskd=function(){
    this.mask.style.visibility="visible";
    this.box.style.visibility="visible";
    move(this.box,this.target,50);
}
Login.prototype.boxd=function(){
    var that=this;
    move(this.box,this.mask.offsetWidth,50,function(){
        that.box.style.visibility="hidden";
        that.mask.style.visibility="hidden";
        that.box.style.marginLeft="0";
    });
}
Login.prototype.resize = function(){
    this.target=(this.mask.offsetWidth-this.box.offsetWidth)/2
    console.log(this.box);
    if(this.box.style.visibility == "visible"){
        this.box.style.marginLeft = this.target+"px";
    }
};
Login.prototype.init=function(){
    var that=this;
    this.handle.onclick=function(){
        that.maskd();
    }
    this.close.onclick=function(){

        that.boxd();
    }
    
}

var reg=new Login("register","registerb");
reg.init();
var log=new Login("login","loginb");
log.init();

window.onresize = function(){
    reg.resize();
    log.resize();
}









var amore=getClassName("a-more")[0];
var article=getClassName("article")[0];
article.style.height="298px";
amore.onclick=function(){
    if(article.style.height=="298px"){
        article.style.height="auto";
        this.innerHTML="<span>收起<i>◇</i></span>";
    }else{
        article.style.height="298px";
        this.innerHTML="<span>展开全文<i>◇</i></span>";
    }
}

var pre=document.getElementById("pre");
var next=document.getElementById("next");
var lbox=getClassName("lbox")[0];
var ul=lbox.children[0];
var lis=ul.children;
var count=0;

init();
function init(){
    ul.style.width=lis[0].offsetWidth*lis.length+"px";
    pre.onclick=preb;
    next.onclick=nextb;
}

function preb(){
    count--;
    changeImage();
}
function nextb(){
    count++;
    changeImage();
}

function changeImage(){
    if(count<0)
    {
        count=0;
    }else if(count>lis.length-1){
        count=lis.length-1;
    }
    move(ul,-count*lis[0].offsetWidth,20);
}






